﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebUI.SystemManage
{
    public partial class Parameter : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Bind();
                BindGrid();
                bnNew.OnClientClick = win_Content.GetShowReference("ParameterEdit.aspx?action=new", "新增属性");
            }
        }

        private void BindGrid()
        {
            Grid1.DataSource = BLL.Parameter.ListallParameter();
            Grid1.DataBind();
        }

        protected void Bind()
        {
            dl_parameterIndex.DataSource = BLL.Parameter.ListIndex();
            dl_parameterIndex.DataTextField = "value";
            dl_parameterIndex.DataValueField = "id";
            dl_parameterIndex.DataBind();
            ExtAspNet.ListItem item = new ExtAspNet.ListItem("请选择","-1");
            dl_parameterIndex.Items.Insert(0,item);
        }

        protected void dl_Selected(object sender, EventArgs e)
        {
            Grid1.DataSource = BLL.Parameter.GetParamList(dl_parameterIndex.SelectedValue);
            Grid1.DataBind();

        }

        protected string GetDelUrl(object id)
        {
            return "javascript:if(confirm('确认删除吗？'))" + win_Content.GetShowReference("ParameterEdit.aspx?action=del&id=" + id);
        }
    }

}